package com.domcer.ultra.menu.application.listener;

import com.domcer.ultra.menu.application.cache.PlayerCache;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;

/**
 * @Author hang.wang
 * @Date 2025/1/31 11:20
 */
public class InventoryCloseListener implements Listener {
    
    @EventHandler
    public void onInventoryClose(InventoryCloseEvent event) {
        HumanEntity humanEntity = event.getPlayer();
        if (humanEntity instanceof Player) {
            Player player = (Player) humanEntity;
            PlayerCache.clear(player);
        }
    }
}
